<div class="feed_quote feed_wb" > <img class="q_ico_arrow2" src="__THEME__/images/zw_img.gif" />
    <div class="q_tit"><img class="q_tit_l" src="__THEME__/images/zw_img.gif" /></div>
    <div class="q_con">
        <div class="new_position">
        <form action="{:U('home/Comment/doQuickReply')}" rel="miniblog_comment"  <neq name="callback" value="">callback="{$callback}"</neq> method="post">
            <input type="hidden" name="to_id" value="{$to_id}">
            <a class="faceicon1" href="javascript:void(0)" onclick="ui.emotions(this)" target_set="comment_{$to_id}"></a>
            <textarea class="left text" name="comment_content" rows="1" style="word-wrap" id="comment_{$to_id}" ></textarea>
            <input type="submit" value="确定" class="N_but" style="*vertical-align:middle;">
            <div style="clear:both; color:#666; margin-left:32px;">
                <label><input name="with_new_weibo" type="checkbox" value="1" />同时发一条微博</label>
            </div>
        </form>
        </div>
    </div>
    <div class="q_btm"><img class="q_btm_l" src="__THEME__/images/zw_img.gif" /></div>
</div>

<script>
    $(document).ready(function(){
        var $comment_content = $("#comment_{$to_id}");
        // textarea自动换行
        $comment_content.jGrow();

        // 	字数限制
        $comment_content.keyup(function(event){
            if(event.keyCode==32 || event.keyCode==8 || event.keyCode==13){
                checkCommentLength(this, _LENGTH_);
            }
        }).keypress(function(){
            checkCommentLength(this, _LENGTH_);
        }).blur(function(){
            checkCommentLength(this, _LENGTH_);
        }).keydown(function(){
            checkCommentLength(this, _LENGTH_);
        }).keyup(function(){
            checkCommentLength(this, _LENGTH_);
        });

        // 附上被回复人的名字
        reply('{$to_uname}',{$to_id});

	    shortcut('ctrl+return',	function(){ $('form[rel="miniblog_comment"]').submit();},{'target':'comment_<?php echo $to_id; ?>'});
    });
     function checkCommentLength(obj,num){
  	 	var $obj = $(obj);
		var str  = $obj.val();  
		var len  = getLength(str);
		if( len > num ){
			$obj.val(subStr(str, num));
		}
	}
    //回复
    function reply( name, to_id ,id){
        var $comment_content = $("#comment_"+to_id);
        $comment_content.val( '回复@'+name+' : ' ).focus();

        var textArea = document.getElementById("comment_"+to_id);
        var strlength = textArea.value.length;
        if (document.selection) { //IE
             var rng = textArea.createTextRange();
             rng.collapse(true);
             rng.moveStart("character",strlength)
        }else if (textArea.selectionStart || (textArea.selectionStart == '0')) { // Mozilla/Netscape…
            textArea.selectionStart = strlength;
            textArea.selectionEnd = strlength;
        }       
    }
</script>